﻿<UserControl x:Class="EpiDashboard.Controls.DotDensityProperties"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Controls="clr-namespace:EpiDashboard.Controls"
             xmlns:EpiDashboard="clr-namespace:EpiDashboard"
             mc:Ignorable="d" 
             d:DesignHeight="860" d:DesignWidth="800" FontFamily="Global User Interface" FontSize="16" Background="White">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../StyleDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MaxWidth="400" MinWidth="300" Width=".33*" />
            <ColumnDefinition Width="30" />
            <ColumnDefinition MinWidth="275" Width=".66*" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <!--<Border Grid.ColumnSpan="100" Grid.RowSpan="100" BorderThickness="2" BorderBrush="#DDDDDD" />-->

        <StackPanel Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0"  Background="{StaticResource PrimaryAccentColorLight}" >
            <Border BorderBrush="#015796" BorderThickness="0 0 0 1">
                <Viewbox StretchDirection="DownOnly" Stretch="Uniform" HorizontalAlignment="Left">
                    <Label x:Name="lblConfigExpandedTitle" FontWeight="Light" Foreground="White" FontSize="56" Margin="0, 0, 0, 10">Dot Density</Label>
                </Viewbox>
            </Border>
        </StackPanel>
        <StackPanel Grid.Column="0" Grid.RowSpan="2" Grid.Row="1" x:Name="panelSidebar" Background="{StaticResource PrimaryAccentColorLight}">
           

            <!--<ToggleButton x:Name="tbtnDataSource" Style="{StaticResource ToggleSidebarButtonStyle}" IsChecked="True" Checked="tbtnDataSource_Checked">
                <StackPanel>
                    <TextBlock Margin="4" FontSize="28" FontWeight="Light">Data Source</TextBlock>
                    <TextBlock Margin="4, 0, 4, 0" FontSize="12" TextWrapping="WrapWithOverflow">Change the data source for the current canvas.</TextBlock>
                </StackPanel>
            </ToggleButton>-->

            <Controls:SettingsToggleButton  x:Name="tbtnDataSource" Title="Data Source" Description="Choose data source." IsChecked="True" Checked="tbtnDataSource_Checked"/>
            <Controls:SettingsToggleButton  x:Name="tbtnVariables" Title="Variables" Description="Choose map variables." IsEnabled="False" IsChecked="False" Checked="tbtnVariables_Checked"/>
            <Controls:SettingsToggleButton  x:Name="tbtnDisplay" Title="Display" IsEnabled="False" Description="Set dot value and color representation." IsChecked="False" Checked="tbtnDisplay_Checked"/>
            <Controls:SettingsToggleButton  x:Name="tbtnFilters" Title=" Filters" IsEnabled="False" Description="Set data filters for this layer." IsChecked="False" Checked="tbtnFilters_Checked"/>


            <!--<ToggleButton x:Name="tbtnHTML" Style="{StaticResource ToggleSidebarButtonStyle}" Checked="tbtnHTML_Checked">
                <StackPanel>
                    <TextBlock Margin="4" FontSize="28" FontWeight="Light">HTML Output</TextBlock>
                    <TextBlock Margin="4, 0, 4, 0" FontSize="12" TextWrapping="WrapWithOverflow">Modify the HTML output settings.</TextBlock>
                </StackPanel>
            </ToggleButton>

            <ToggleButton x:Name="tbtnCharts" Style="{StaticResource ToggleSidebarButtonStyle}" Checked="tbtnCharts_Checked">
                <StackPanel>
                    <TextBlock Margin="4" FontSize="28" FontWeight="Light">Charts</TextBlock>
                    <TextBlock Margin="4, 0, 4, 0" FontSize="12" TextWrapping="WrapWithOverflow">Set default chart settings for this canvas.</TextBlock>
                </StackPanel>
            </ToggleButton>

            <ToggleButton x:Name="tbtnInfo" Style="{StaticResource ToggleSidebarButtonStyle}" Checked="tbtnInfo_Checked">
                <StackPanel>
                    <TextBlock Margin="4" FontSize="28" FontWeight="Light">Information</TextBlock>
                    <TextBlock Margin="4, 0, 4, 0" FontSize="12" TextWrapping="WrapWithOverflow">View technical details about this canvas.</TextBlock>
                </StackPanel>
            </ToggleButton>-->
        </StackPanel>

        <DockPanel x:Name="panelDataSource" Grid.Column="2" Grid.Row="1" Margin="0, 0, 10, 0" Visibility="Visible" VerticalAlignment="Stretch">
            <StackPanel DockPanel.Dock="Top">
                <Label x:Name="tblockPanelDataSource" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">Data Source</Label>
                <StackPanel Orientation="Horizontal">
                    <TextBlock FontSize="15"  Foreground="Red" Margin="0 1 0 0 ">*</TextBlock>
                    <TextBlock FontSize="10" Foreground="Red" Margin="3 0 0 10" x:Name="dataSourceRequiredFields"> = Required</TextBlock>
                </StackPanel>
            </StackPanel>

            <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" DockPanel.Dock="Bottom">
                <StackPanel Margin="0 0 0 5">
                    <StackPanel x:Name="panelDataSourceProject" Visibility="Visible">
                        <WrapPanel Orientation="Horizontal">
                            <Label Padding="0" x:Name="tblockDataSource">Data Source:</Label>
                            <TextBlock Style="{StaticResource requiredFieldInd}" VerticalAlignment="Top" Margin="2 0 0 0" Text="*">
                                <TextBlock.ToolTip>
                                    <TextBlock x:Name="dataSourceRequiredField">Required field</TextBlock>
                                </TextBlock.ToolTip>  
                            </TextBlock>
                        </WrapPanel>
                        <Grid>
                            <WrapPanel Orientation="Horizontal">
                                <StackPanel Margin="0 0 20 10">
                                    <TextBox TextWrapping="Wrap" MinWidth="300" MaxWidth="600" x:Name="txtProjectPath" IsReadOnly="True" TextChanged="txtProjectPath_TextChanged"></TextBox>
                                </StackPanel>
                                <StackPanel Margin="0 0 20 0">
                                    <Button Height="25" x:Name="btnBrowse" Click="btnBrowse_Click">Browse</Button>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Background="Transparent" >
                                    <EpiDashboard:WaitCursor x:Name="waitCursor" Width="25" Height="25" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed" StackPanel.ZIndex="99"/>
                                    <TextBlock Margin="5 0 0 0" x:Name="tblockLoadingData" Visibility="Collapsed" VerticalAlignment="Center" HorizontalAlignment="Center" Style="{StaticResource PropertiesInstructionsText}" FontSize="10">Loading Data...</TextBlock>
                                </StackPanel>
                            </WrapPanel>
                        </Grid>

                    </StackPanel>

                    <StackPanel x:Name="panelDataSourceOther" Visibility="Collapsed">
                        <Label x:Name="tblockConnectionString">Connection String:</Label>
                        <TextBox x:Name="txtDataSource" Margin="0,0,0,8" />
                    </StackPanel>

                    <StackPanel x:Name="panelDataSourceAdvanced" Visibility="Collapsed">
                        <Label x:Name="tblockSQLQuery">SQL Query:</Label>
                        <TextBox x:Name="txtSQLQuery"></TextBox>
                    </StackPanel>
                    <Label></Label>

                    <StackPanel x:Name="panelBoundaries" IsEnabled="False" Margin="0 20 0 0">
                        <WrapPanel Orientation="Horizontal">
                            <Label x:Name="lblBoundaries" Style="{StaticResource PropertiesSubHeading}">Boundaries</Label>
                            <TextBlock VerticalAlignment="Top" Style="{StaticResource requiredFieldInd}" Margin="2 0 0 0" Text="*">
                                <TextBlock.ToolTip>
                                    <TextBlock x:Name="boundariesRequiredField">Required - Select a Shapefile, Map Server or KML File</TextBlock>
                                </TextBlock.ToolTip>   
                            </TextBlock>
                        </WrapPanel>
                        <StackPanel Margin="0 15 0 0" HorizontalAlignment="Left">
                            <RadioButton x:Name="radShapeFile"  GroupName="radboundary" Content="Shapefile" Checked="radShapeFile_Checked"  />
                            <StackPanel Margin="18 5 0 0" x:Name="panelshape" IsEnabled="False">
                                <Grid>
                                    <WrapPanel Orientation="Horizontal">
                                        <StackPanel Margin="0 0 20 10">
                                            <TextBox TextWrapping="Wrap" MinWidth="300" MaxWidth="600" x:Name="txtShapePath" IsReadOnly="False" TextChanged="txtProjectPath_TextChanged"   ></TextBox>
                                        </StackPanel>
                                        <StackPanel>
                                            <Button x:Name="btnBrowseShape" Click="btnBrowseShapeFile_Click" Height="25" >Browse</Button>
                                        </StackPanel>
                                    </WrapPanel>
                                </Grid>
                            </StackPanel>
                        </StackPanel>
                        
                        <WrapPanel Orientation="Horizontal">
                        <StackPanel Margin="0 20 20 0">
                            <RadioButton x:Name="radMapServer"  GroupName="radboundary"  Content="Map Server" Checked="radMapServer_Checked" />
                            <StackPanel x:Name="panelmap" IsEnabled="False" Margin="0 0 0 0 "   >
                                <StackPanel Margin="18 5 0 0" x:Name="panelmapconnect" IsEnabled="False"/>
                                <StackPanel Margin="0 0 0 0 ">
                                    <StackPanel Margin="18 5 0 0" x:Name="panelmapserver" IsEnabled="False" HorizontalAlignment="Left">
                                        <Label Padding="0" x:Name="lblURL">URL:</Label>
                                        <Grid>
                                            <WrapPanel Orientation="Horizontal">
                                                <StackPanel Margin="0 0 20 10">
                                                    <TextBox MinWidth="200" Width="200" TextWrapping="Wrap" x:Name="txtMapSeverpath"  TextChanged="txtMapSeverpath_TextChanged"  ></TextBox>
                                                </StackPanel>
                                                <StackPanel>
                                                    <Button Height="25" x:Name="btnMapserverlocate" IsEnabled="False" Click="btnMapserverlocate_Click" >Connect</Button>
                                                </StackPanel>
                                            </WrapPanel>
                                        </Grid>

                                            <TextBox TextWrapping="Wrap" MinWidth="320" Width="320" IsReadOnly="True" HorizontalAlignment="Left" x:Name="lblExampleMapServerURL" Style="{StaticResource PropertiesExampleText}">Example: http://services.nationalmap.gov/ArcGIS/rest/services/govunits/MapServer</TextBox>
                                            <StackPanel Margin="0 15 0 0">
                                                <Label Padding="0" x:Name="lblSelectFeature">Select Feature:</Label>
                                                <ComboBox MinWidth="320" Width="Auto" MaxWidth="600" x:Name="cbxmapfeature" HorizontalAlignment="Left" SelectionChanged="cbxmapfeature_SelectionChanged"></ComboBox>
                                            </StackPanel>
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>

                        <StackPanel Margin="0 20 0 0">
                            <RadioButton x:Name="radKML"   GroupName="radboundary" Content="KML File" Checked="radKML_Checked" />
                            <StackPanel Margin="18 10 0 0" x:Name="panelKml" IsEnabled="False" >
                                <Label Padding="0" x:Name="lblURLOfKMLFile">Location URL of KML File:</Label>
                                
                                <Grid>
                                    <WrapPanel Orientation="Horizontal">
                                        <StackPanel Margin="0 0 20 10">
                                            <TextBox TextWrapping="Wrap" MinWidth="200" Width="200" x:Name="txtKMLpath" IsReadOnly="False" TextChanged="PropertyChanged_EnableDisable" ></TextBox>
                                        </StackPanel>
                                        <StackPanel>
                                            <Button x:Name="btnKMLFile" Height="25" Click="btnKMLFile_Click">Browse</Button>
                                        </StackPanel>
                                    </WrapPanel>
                                </Grid>
                                    <TextBox  TextWrapping="Wrap" MinWidth="320" Width="320" HorizontalAlignment="Left" IsReadOnly="True" x:Name="lblExampleKMLFile" Margin="0 0 0 0" Style="{StaticResource PropertiesExampleText}">Example: http://code.google.com/apis/kml/documentation/us_states.kml</TextBox>
                            </StackPanel>
                        </StackPanel>
                        </WrapPanel>
                    </StackPanel>
                        
                </StackPanel>
            </ScrollViewer>
        </DockPanel>

        <DockPanel x:Name="panelVariables" Grid.Column="2" Grid.Row="1" Margin="8" Visibility="Collapsed">
            <StackPanel DockPanel.Dock="Top">
                <Label x:Name="tblockPanelVariables" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">Variables</Label>
                <Label x:Name="tblockSelectVarData" Style="{StaticResource PropertiesSubHeading}" Margin="0, 0, 0, 10">Select variables for map.</Label>
                <StackPanel Orientation="Horizontal">
                    <TextBlock FontSize="15"  Foreground="Red" Margin="0 1 0 0 ">*</TextBlock>
                    <TextBlock FontSize="10" Foreground="Red" Margin="3 0 0 10" x:Name="variablesRequiredFields"> = Required</TextBlock>
                </StackPanel>
            </StackPanel>

            <ScrollViewer DockPanel.Dock="Bottom" ScrollViewer.VerticalScrollBarVisibility="Auto" >
                <StackPanel>

                    <StackPanel Margin="0 5 0 0">
                        <Label Padding="0" x:Name="tblockDataSourceVariables" Style="{StaticResource PropertiesSubHeading}">Data Source</Label>
                        <WrapPanel Orientation="Horizontal">
                            <Label x:Name="lblData">Data Key:</Label>
                            <TextBlock VerticalAlignment="Top" Style="{StaticResource requiredFieldInd}" Margin="2 0 0 0" Text="*">
                                <TextBlock.ToolTip>
                                    <TextBlock x:Name="dataKeyRequiredField">Required field</TextBlock>
                                </TextBlock.ToolTip>   
                                </TextBlock>
                        </WrapPanel>
                        <ComboBox x:Name="cmbDataKey" HorizontalAlignment="Left" IsEnabled="True" Style="{StaticResource PropertiesComboxStyleLarge}" SelectionChanged="cmbDataKey_SelectionChanged" Height="25" Width="300"></ComboBox>
                    </StackPanel>
                    <StackPanel Margin="0 5 0 0">
                        <WrapPanel Orientation="Horizontal">
                            <Label x:Name="lblValue">Value:</Label>
                            <TextBlock VerticalAlignment="Top" Style="{StaticResource requiredFieldInd}" Margin="2 0 0 0" Text="*">
                                <TextBlock.ToolTip>
                                    <TextBlock x:Name="valueFieldRequiredField">Required field</TextBlock>
                                </TextBlock.ToolTip>   
                                </TextBlock>
                        </WrapPanel>
                        <ComboBox x:Name="cmbValue" HorizontalAlignment="Left" IsEnabled="false" Style="{StaticResource PropertiesComboxStyleLarge}" SelectionChanged="cmbValue_SelectionChanged"  Height="25" Width="300"></ComboBox>
                    </StackPanel>

                    <StackPanel Margin="0 25 0 0">
                        <Label x:Name="lblBoundarieVariable"  Style="{StaticResource PropertiesSubHeading}">Boundaries</Label>
                        <WrapPanel Orientation="Horizontal">
                            <Label x:Name="lblFeature">Feature Key:</Label>
                            <TextBlock VerticalAlignment="Top" Style="{StaticResource requiredFieldInd}" Margin="0 0 0 0" Text="*">
                                <TextBlock.ToolTip>
                                    <TextBlock x:Name="featureKeyRequiredField">Required field</TextBlock>
                                </TextBlock.ToolTip>   
                             </TextBlock>
                        </WrapPanel>
                        <ComboBox x:Name="cmbShapeKey" HorizontalAlignment="Left" Style="{StaticResource PropertiesComboxStyleLarge}"  SelectionChanged="cmbShapeKey_SelectionChanged" Width="300"></ComboBox>
                    </StackPanel>

                </StackPanel>
            </ScrollViewer>
        </DockPanel>

        <StackPanel x:Name="panelInfo" Grid.Column="2" Grid.Row="1" Margin="8" Visibility="Collapsed">
            <Label Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">Canvas Information</Label>
            <TextBlock x:Name="tblockRows" Text="2,255 unfiltered rows" Margin="0,0,0,16" />
            <TextBlock x:Name="tblockColumns" Text="252 columns" Margin="0,0,0,16" />
            <TextBlock x:Name="tblockCacheDateTime" Text="Data last cached at 12/16/2011 1:56 PM" Margin="0,0,0,16" />
            <TextBlock x:Name="tblockCacheTimeElapsed" Text="Took 4:32:32 to locally cache data" Margin="0,0,0,16" />
            <TextBlock x:Name="tblockCurrentEpiVersion" Text="Epi Info 7.0.0.0" Margin="0,0,0,16" />
        </StackPanel>

        <StackPanel x:Name="panelDisplay" Grid.Column="2" Grid.Row="1"  Margin="0, 0, 10, 0" Visibility="Collapsed">
            <Label x:Name="lblPanelHdrColorsAndStyles" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">Color and Ranges</Label>
            <!--<Label>Note: Any filters set here are applied to this gadget only.</Label>-->


            <!--<Label Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">Colors &amp; Ranges</Label>-->
            <StackPanel Orientation="Horizontal">
                <Label x:Name="tblcolor">Select Color:</Label>
                <StackPanel Style="{StaticResource FieldSpacer}"></StackPanel>

                <Rectangle x:Name="rctDotColor" MouseLeftButtonUp="rctDotColor_MouseLeftButtonUp"  HorizontalAlignment="Left" VerticalAlignment="Center" Height="20" Width="20" Stroke="DarkGray" Cursor="Hand" Fill="#F00000FF">
                <Rectangle.ToolTip>
                    <Label Content="Color"/>
                </Rectangle.ToolTip>
            </Rectangle>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <Label x:Name="lblDotValue" Margin="0,0,15,0">Dot Value:</Label>
                <StackPanel Style="{StaticResource FieldSpacer}"></StackPanel>
                <TextBox x:Name="txtDotValue" Text="1" PreviewKeyDown="txtInput_PositiveIntegerOnly_PreviewKeyDown" ></TextBox>
            </StackPanel>
        </StackPanel>

        <DockPanel x:Name="panelFilters" Grid.Column="2" Grid.Row="1" Margin="0, 0, 10, 0" Visibility="Collapsed">
            <StackPanel Grid.Column="2" DockPanel.Dock="Top" >
            <Label x:Name="tblockPanelDataFilter" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">Data Filters</Label>
            <Label x:Name="tblockSetDataFilter" Style="{StaticResource PropertiesSubHeading}" Margin="0, 0, 0, 10">Set data filters for this layer.</Label>
            <Label x:Name="tblockAnyFilterGadgetOnly" Margin="0, 0, 0, 20">Note: First select a data source to add a filter to layer.</Label>
           
        </StackPanel>
          </DockPanel>
        <Button Style="{StaticResource CloseButtonStyle}" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="8" Click="CloseButton_Click" />

        <DockPanel Grid.ColumnSpan="3" Grid.Row="2">
            <Button x:Name="btnCancel" DockPanel.Dock="Right" HorizontalAlignment="Right" Margin="8" Width="134" Height="42" Click="btnCancel_Click">Cancel</Button>
            <Button x:Name="btnOK" IsEnabled="false" DockPanel.Dock="Right" HorizontalAlignment="Right" Margin="8" Width="134" Height="42" Click="btnOK_Click">OK</Button>
        </DockPanel>
    </Grid>
</UserControl>
